package com.yang.inventorymanagement.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @TableName products
 */
@TableName(value = "products")
@Data
public class Products implements Serializable {
    /**
     * 商品ID
     */
    @TableId(type = IdType.AUTO)
    private Integer productid;

    /**
     * 商品名称
     */
    private String productname;

    /**
     * 商品数量
     */
    private Integer quantity;

    /**
     * 创建时间
     */
    private Date createdattime;

    /**
     * 创建人
     */
    private Integer createdbyid;

    /**
     * 修改时间
     */
    private Date updatedattime;

    /**
     * 修改人
     */
    private Integer updatedbyid;

    /**
     * 逻辑删除字段
     */
    private Integer isdeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;



    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Products other = (Products) that;
        return (this.getProductid() == null ? other.getProductid() == null : this.getProductid().equals(other.getProductid()))
                && (this.getProductname() == null ? other.getProductname() == null : this.getProductname().equals(other.getProductname()))
                && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
                && (this.getCreatedattime() == null ? other.getCreatedattime() == null : this.getCreatedattime().equals(other.getCreatedattime()))
                && (this.getCreatedbyid() == null ? other.getCreatedbyid() == null : this.getCreatedbyid().equals(other.getCreatedbyid()))
                && (this.getUpdatedattime() == null ? other.getUpdatedattime() == null : this.getUpdatedattime().equals(other.getUpdatedattime()))
                && (this.getUpdatedbyid() == null ? other.getUpdatedbyid() == null : this.getUpdatedbyid().equals(other.getUpdatedbyid()))
                && (this.getIsdeleted() == null ? other.getIsdeleted() == null : this.getIsdeleted().equals(other.getIsdeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getProductid() == null) ? 0 : getProductid().hashCode());
        result = prime * result + ((getProductname() == null) ? 0 : getProductname().hashCode());
        result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
        result = prime * result + ((getCreatedattime() == null) ? 0 : getCreatedattime().hashCode());
        result = prime * result + ((getCreatedbyid() == null) ? 0 : getCreatedbyid().hashCode());
        result = prime * result + ((getUpdatedattime() == null) ? 0 : getUpdatedattime().hashCode());
        result = prime * result + ((getUpdatedbyid() == null) ? 0 : getUpdatedbyid().hashCode());
        result = prime * result + ((getIsdeleted() == null) ? 0 : getIsdeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", productid=").append(productid);
        sb.append(", productname=").append(productname);
        sb.append(", quantity=").append(quantity);
        sb.append(", createdattime=").append(createdattime);
        sb.append(", createdbyid=").append(createdbyid);
        sb.append(", updatedattime=").append(updatedattime);
        sb.append(", updatedbyid=").append(updatedbyid);
        sb.append(", isdeleted=").append(isdeleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}